package com.aaa.docter.service.Impl;

import com.aaa.docter.Fegin.RegisteredItemDao;

import com.aaa.docter.dao.RegisteredDao;
import com.aaa.docter.service.RegisteredService;
import com.aaa.entity.HisPatient;
import com.aaa.entity.RegisteredItem;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

@Service
public class RegisteredServiceImpl implements RegisteredService {

    @Autowired
    private RegisteredDao registeredDao;

    @Autowired
    private RegisteredItemDao registeredItemDao;



    @Override
    public Result<HisPatient> getAll(String idCard) {
        QueryWrapper<HisPatient> wrapper = new QueryWrapper<>();
        if (StringUtils.hasText(idCard)){
            wrapper.eq("id_Card",idCard);
        }
        HisPatient hisPatient = registeredDao.selectOne(wrapper);

        return new Result<>(2000,"患者信息查询成功",hisPatient);
    }

    //
    @Override
    public Result<List<RegisteredItem>> getList( ) {

        System.out.println("----------------------------------");
        Result<List<RegisteredItem>> listResult = registeredItemDao.queryByRegItemName();

        return listResult;
    }

}
